// 定义basesize来实现rem
var root = document.documentElement,
  baseSize = 0,
  timer
var setBaseSize = function() {
  baseSize = root.clientWidth / 750 * 40
  baseSize = baseSize > 40 ? 40 : baseSize
  root.style.fontSize = baseSize + 'px'
}
window.addEventListener(
  'resize',
  function() {
    timer && clearTimeout(timer)
    timer = setTimeout(setBaseSize, 300)
  },
  false
)
setBaseSize()
